// pages/sc-modal-test/sc-modal-test.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        down: false,
        isShow: false,
        groupList: [],
        showLoadingFlag: false,
    },

    onOpen() {
        this.setData({
            isShow: true
        });
    },


    change() {
        let down = !this.data.down;
        this.setData({
            down: down
        });
    },

    errorModalChange(e) {
        let self = this;
        let modal = e.detail;
        let isShow = this.data.isShow;
        self.setData({
            isShow: !isShow
        });
        if (modal.type == 1) {
            console.log('确定');
        }
        if (modal.type == 0) {
            console.log('取消');
        }
    },

    showGroupSize(size) {
        let self = this;
        if (size == 1) {
            let groupList = [{
                name: 'a',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'c',
                img: ''
            }, ];
            self.setData({
                groupList: groupList
            })
        } else if (size == 2) {
            let groupList = [{
                name: 'a',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'b',
                img: ''
            }, {
                name: 'c',
                img: ''
            }, ];
            self.setData({
                groupList: groupList
            })
        }
    },
    showGroupList(e) {
        let self = this;
        let size = e.currentTarget.dataset.size;
        self.showGroupSize(size);
    },

    showLoadingFlag() {
        let self = this;
        let showLoadingFlag= !self.data.showLoadingFlag;
        self.setData({
            showLoadingFlag: showLoadingFlag
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        let self = this;
        // self.showGroupSize(1);
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

})